<?php include "../public/header.php"?>
<?php include "../public/header_public.php"?>
<body class="laytp-container">
<div style="height: 45px"></div>
<div id="opt_nav">
</div>
<div id="dialog">
    <div class="page-title" id="page-title">
        <div class="page-title-con">
            <span class="title">选择往来单位信息</span>
            <div class="move_title"></div>
            <div class="page-title-opt-list">
                <button class="layui-btn layui-btn-sm btn-dark marginr5" type="button" id="submit">确定</button>
                <span id="page-close" class="page-close" onclick="layer_close()">×</span>
            </div>
        </div>
    </div>
</div>


<div class="layui-card" id="search-form">
    <div class="layui-card-body">
        <form class="layui-form" id="TableSearchFormId" lay-filter="TableSearchForm" onkeydown="keyTableSearch('TableSearchForm', 'datalist')">
            <div class="layui-form-item">
                <div class="layui-row">
                    <div class="layui-col-md3 layui-col-xs12 layui-col-sm6">
                        <label class="layui-form-label">单位名称</label>
                        <div class="layui-input-block">
                            <input type="text" name="name" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
<!--                    <div class="layui-col-md3">-->
<!--                        <label class="layui-form-label">所属分类</label>-->
<!--                        <div class="layui-input-block">-->
<!--                            <div id="type" class="xmselect_div">-->
<!--                                <div class="xmselect_title">请选择</div>-->
<!--                            </div>-->
<!--                        </div>-->
<!--                    </div>-->
                    <div class="layui-col-md3">
                        <label class="layui-form-label">税务类型</label>
                        <div class="layui-input-block">
                            <div id="taxtype" class="xmselect_div">
                                <div class="xmselect_title">请选择</div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-md3">
                        <label class="layui-form-label">税号</label>
                        <div class="layui-input-block">
                            <input type="text" name="ratenum" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">电话号码</label>
                        <div class="layui-input-block">
                            <input type="text" name="phone" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">单位评级</label>
                        <div class="layui-input-block">
                            <div id="danlevel" class="xmselect_div">
                                <div class="xmselect_title">请选择</div>
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">联系人</label>
                        <div class="layui-input-block">
                            <input type="text" name="lianer" id="lianer" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>
                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">联系人手机号</label>
                        <div class="layui-input-block">
                            <input type="text" name="liantel" placeholder="请输入" class="layui-input" autocomplete="off">
                        </div>
                    </div>

                    <div class="layui-col-md3 search_hide none">
                        <label class="layui-form-label">审核状态：</label>
                        <div class="layui-input-block">
                            <select id="status" name="status" lay-filter="status">
                                <option value="">请选择</option>
                                <option value="1">流程（审批通过）</option>
                                <option value="0">流程（审批中）</option>
                            </select>
                        </div>
                    </div>
                    <div class="layui-col-md3 layui-col-xs6">
                        <div class="layui-form-item search-div">
                            <div class="layui-form-item layui-inline">
                                <input type="hidden" id="type" name="type">
                                <button class="laytp-btn laytp-btn-md laytp-btn-primary" id="TableSearchButton" type="button"><i class="layui-icon layui-icon-search"></i>查询</button>
                                <button class="layui-btn layui-btn-primary" onclick="listTableReset()" id="TableSearchReset" type="reset" ><i class="layui-icon layui-icon-refresh"></i>重置</button>
                                <div id="search_open" onclick="toggle_search()">
                                    <i class="layui-icon layui-icon-down"></i>展开
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
</div>

<div class="layui-card" id="table-card">
    <div class="layui-card-body">
        <div class="layui-row">
            <?php include '../dealcom/dao.php' ?>

            <div class="layui-col-md10" id="table_list">
                <div class="layui-card-body">
                    <table id="datalist" lay-filter="datalist"></table>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/html" id="toolbarDemo">
    <div class = "layui-btn-container">
        <button class="layui-btn layui-btn-primary outbut" onclick="auth_but_func_add_flow('新建')">
            <i class="layui-icon layui-icon-add-1"></i>新建
        </button>
    </div>
</script>
<script type="text/html" id="test-dropdown-toolbar-barDemo">
    <div class="tab-list-authbut">
        <a href="javascript:;" class="bar_opt" onclick="auth_but_func_show('{{d.id}}')">查看</a>
        <a href="javascript:;" class="bar_opt" onclick="auth_but_func_edit('{{d.id}}')">编辑</a>
    </div>
</script>
<script type="text/javascript">
    // 单选多选分类 默认单选 choose_type传值为多选
    var choose_type = getQueryVariable('choose_type');
    if(choose_type === undefined || choose_type === false){
        choose_type = 'radio';
    }else{
        choose_type = 'checkbox';
    }

    var parent_dom = getQueryVariable('dom');
    var parent_enginid = getQueryVariable('enginid') || 0;
    var parent_domkey = getQueryVariable('domkey');
    var parent_page = getQueryVariable('page');


    var parent_lianer = decodeURI(getQueryVariable('lianer') || '') || '';
    if(parent_lianer){
        $("#lianer").val(parent_lianer);
        $("#lianer").prop('disabled', true);
        $("#lianer").addClass('disabled');
    }


    layui.use(["laytp",'laypage','table','dropdown','form','soulTable'], function () {
        var laypage = layui.laypage, table = layui.table, dropdown = layui.dropdown, form = layui.form, soulTable = layui.soulTable;

        $('#TableSearchReset').click(function () {
            $('.xmselect_div>xm-select').find('.xm-label-block').css('display','none');
            $('.xmselect_div').append('<div class="xmselect_title">请选择</div>');
            searchTableFunc(form, table)
        });

        $("#cols_table").hide();
        $("#export_table").hide();
        table.render({
            elem: "#datalist",id: "datalist"
            ,url: facade.url(ask_opt_get_dealcom),where: {enginid:parent_enginid,lianer_zhi:parent_lianer}, page: true, height: 'full-140'
            ,soulSort: TabInit.soulSort,method: TabInit.method, toolbar: TabInit.toolbar, overflow: TabInit.overflow
            ,defaultToolbar: ['', '', ''],filter: TabInit.filter
            ,request: TabInit.request,response: TabInit.response,contextmenu:get_table_contextmenu(soulTable)
            ,parseData: function(res){

                // xmselect_dan('type', res.data.type, res.data.is_type, function (res) {
                //     setTimeout(function () {
                //         searchTableFunc(form, table);
                //     },100)
                // })
                xmselect_dan('taxtype', res.data.taxtype, res.data.is_taxtype, function (res) {
                    setTimeout(function () {
                        searchTableFunc(form, table);
                    },100)
                })
                xmselect_dan('danlevel', res.data.danlevel, res.data.is_danlevel, function (res) {
                    setTimeout(function () {
                        searchTableFunc(form, table);
                    },100)
                })


                return {
                    "code": res.code,
                    "msg": res.message,
                    "count": res.data.data.total,
                    "data": res.data.data.data
                };
            }
            ,cols: [[
                {type:choose_type,fixed:'left'}
                ,{type:'numbers',title:'序号',fixed:'left'}
                ,{field: 'name', title: '单位名称'}
                ,{field: 'type', title: '所属分类'}
                ,{field: 'nature', title: '单位性质'}
                ,{field: 'legaler', title: '法定代表人'}
                ,{field: 'zhuaddr', title: '注册地址'}
                ,{field: 'taxtype', title: '税务类型'}
                ,{field: 'ratenum', title: '税号'}
                ,{field: 'piaotype', title: '开票类型'}
                ,{field: 'rate', title: '税点(%)'}
                ,{field: 'unitaddr', title: '单位地址'}
                ,{field: 'phone', title: '电话号码'}
                ,{field: 'genre', title: '经营类别'}
                ,{field: 'danlevel', title: '单位评级'}
                ,{field: 'lianer', title: '联系人'}
                ,{field: 'liantel', title: '联系人手机号'}
                ,{fixed: 'right', title:'操作', toolbar: '#test-dropdown-toolbar-barDemo',align:'center',width:200}
            ]]
            ,done : function(res, curr, count){
                // $(".layui-table-tool").remove()
                soulTable.render(this);
            }
        });
        listTableSearch(form, table);


        $('#submit').on('click', function () {
            var checkStatus = layui.table.checkStatus('datalist');
            var data = checkStatus.data;
            if(data.length < 1){
                facade.error("请选择数据");return false;
            }

            if(parent_page == 'user'){
                var str = '';
                for(var key in data){
                    str += '<button type="button" style="width: auto;" class="layui-btn layui-btn-sm btn-dark" key="'+data[key].id+'"><span class="choose_content">'+data[key].name+'' +
                        '</span><span class="choose_close" onclick="choose_close(this, \''+parent_dom+'\')">×</span></button>';
                }
                $("#"+parent_dom , parent.document).append(str);
                var h = $("#"+parent_dom , parent.document).height();
                $("."+parent_dom , parent.document).css('cssText','height:'+ (h+5) +'px !important');

                parent.formValid(parent_dom);

            }else if(parent_page == 'bid'){
                var str = '';
                for(var key in data){
                    str += '<button type="button" style="width: auto;max-width: 95%;" class="layui-btn layui-btn-sm btn-dark" key="'+data[key].id+'"><span class="choose_content">'+data[key].name+'' +
                        '</span><span class="choose_close" onclick="choose_close(this, \''+parent_dom+'\')">×</span></button>';
                }
                $("#"+parent_dom , parent.document).html(str);
                var h = $("#"+parent_dom , parent.document).height();
                $("."+parent_dom , parent.document).css('cssText','height:'+ (h+5) +'px !important');

                parent.formValid(parent_dom);
            }else if(parent_page == 'piao_put'){
                $("#list_list tr", parent.document).eq(parent_domkey).find('.gonger').val(data[0].name);
                if (typeof(window.parent.update_refresh_row_func)!="undefined"){
                    window.parent.update_refresh_row_func();
                }
            }else if(parent_page == 'payment_qian'){
                $("#list_list tr", parent.document).eq(parent_domkey).find('.gonger').val(data[0].name);
                $("#list_list tr", parent.document).eq(parent_domkey).find('.banknum').val(data[0].banknum);
                $("#list_list tr", parent.document).eq(parent_domkey).find('.bankname').val(data[0].bankname);
                if (typeof(window.parent.update_refresh_row_func)!="undefined"){
                    window.parent.update_refresh_row_func();
                }
            }else if(parent_page == 'payment_yuzhi'){
                $("#list_list tr", parent.document).eq(parent_domkey).find('.gonger').val(data[0].name);
                $("#list_list tr", parent.document).eq(parent_domkey).find('.banknum').val(data[0].banknum);
                $("#list_list tr", parent.document).eq(parent_domkey).find('.bankname').val(data[0].bankname);
                if (typeof(window.parent.update_refresh_row_func)!="undefined"){
                    window.parent.update_refresh_row_func();
                }
            }else if(parent_page == 'payment_qi'){
                $("#list_list tr", parent.document).eq(parent_domkey).find('.gonger').val(data[0].name);
                $("#list_list tr", parent.document).eq(parent_domkey).find('.banknum').val(data[0].banknum);
                $("#list_list tr", parent.document).eq(parent_domkey).find('.bankname').val(data[0].bankname);
                if (typeof(window.parent.update_refresh_row_func)!="undefined"){
                    window.parent.update_refresh_row_func();
                }
            }else if(parent_page == 'dealcom_geng'){
                var str = '<button type="button" class="layui-btn layui-btn-sm btn-dark" key="'+data[0].id+'"><span class="choose_content">'+data[0].name+'' +
                    '</span><span class="choose_close" onclick="choose_close(this, \''+parent_dom+'\')">×</span></button>';
                $("#"+parent_dom , parent.document).html(str);
                parent.formValid(parent_dom);

                $("#name" , parent.document).val(data[0].name);
                $("#legaler" , parent.document).val(data[0].legaler);
                $("#zhuaddr" , parent.document).val(data[0].zhuaddr);
                $("#taxtype" , parent.document).val(data[0].taxtype);
                $("#piaotype" , parent.document).val(data[0].piaotype);
                $("#rate" , parent.document).val(data[0].rate);
                $("#ratenum" , parent.document).val(data[0].ratenum);
                $("#unitaddr" , parent.document).val(data[0].unitaddr);
                $("#phone" , parent.document).val(data[0].phone);
                $("#bankname" , parent.document).val(data[0].bankname);
                $("#banknum" , parent.document).val(data[0].banknum);
                $("#genre" , parent.document).val(data[0].genre);
                $("#lianer" , parent.document).val(data[0].lianer);
                $("#liantel" , parent.document).val(data[0].liantel);
                $("#explain" , parent.document).val(data[0].explain);

                window.parent.set_type(data[0].type_old);
                window.parent.set_nature(data[0].nature_old);
                window.parent.set_taxtype(data[0].taxtype_old);
                window.parent.set_danlevel(data[0].danlevel_old);
                window.parent.set_piaotype(data[0].piaotype_old);
                window.parent.public_upload_file_load('upload_files', data[0].files);

            }else if(parent_page == 'payment_engin'){
                var pub_qutype = parent.pub_qutype;
                var nums = $("#list_list tr", parent.document).length;
                for (var key in data){
                    var str = '';
                    nums++;
                    str += '<tr>';
                    str += '<td style="width: 45px">'+nums+'</td>';
                    str += '<td><input type="text" class="layui-input " readonly value="销售方付款"></td>';
                    str += '<td>';
                    str += '<input type="text" futype="3" caiid="0" readonly value="" class="layui-input name disabled">';
                    str += '</td>';
                    str += '<td><input type="text" value="'+data[key].name+'" readonly class="layui-input gonger disabled"></td>';
                    str += '<td><input type="text" class="layui-input leiyifu" value="'+data[key].leiyifu+'"></td>';
                    str += '<td><input type="text" class="layui-input leiyipiao" value="'+data[key].leiyipiao+'"></td>';
                    str += '<td><input type="text" class="layui-input leiyiqian" value="'+data[key].leiyiqian+'"></td>';
                    str += '<td><input type="number" class="layui-input money"></td>';


                    str += '<td>';
                    str += '<select class="layui-select qutype">';
                    str += '<option value="">请选择</option>';
                    for (var mmm in pub_qutype){
                        str += '<option value="'+mmm+'">'+pub_qutype[mmm]+'</option>';
                    }
                    str += '</select>';
                    str += '</td>';

                    str += '<td><div class="incdaotype incdaotype'+nums+'" key="'+nums+'"></div></td>';

                    str += '<td><input type="text" class="layui-input banknum" value="'+data[key].banknum+'"></td>';
                    str += '<td><input type="text" class="layui-input bankname" value="'+data[key].bankname+'"></td>';
                    str += '<td><input type="text" class="layui-input explain"></td>';
                    str += '</tr>';
                    $("#list_list", parent.document).append(str);
                    parent.xmselect_list_dan('incdaotype'+nums, parent.pub_incdaotype, '');
                }


                if (typeof(window.parent.update_refresh_row_func)!="undefined"){
                    window.parent.update_refresh_row_func();
                }
            }else if(parent_page == 'qian_zhi'){
                var nums = $("#list_list tr", parent.document).length;
                for (var key in data){
                    var str = '';
                    nums++;
                    str += '<tr>';
                    str += '<td style="width: 45px">'+nums+'</td>';
                    str += '<td><div class="zhiqianlei zhiqianlei'+nums+'" key="'+nums+'"></div></td>';
                    str += '<td><input type="text" onclick="choose_dealcom_one(this)" value="'+data[key].name+'" readonly class="layui-input fuer disabled"></td>';

                    var ListZhangName = '';
                    var ListZhangKai = '';
                    if(data[key].list){
                        ListZhangName = data[key].list.zhangname+''+data[key].list.banknum
                        ListZhangKai = data[key].list.bankname
                    }
                    str += '<td><input type="text" onclick="choose_dealcom_bank(this)" value="'+ListZhangName+'" readonly class="layui-input banknum disabled"></td>';
                    str += '<td><input type="text" value="'+ListZhangKai+'" disabled class="layui-input bankname disabled"></td>';
                    str += '<td><input type="number" class="layui-input money"></td>';
                    str += '<td><div class="incdaotype incdaotype'+nums+'" key="'+nums+'"></div></td>';
                    str += '<td><input type="text" class="layui-input explain"></td>';
                    str += '<td><input type="text" onclick="choose_qian_piao_guan(this)" readonly class="layui-input difee disabled"><span class="difeeobj layui-hide"></span></td>';
                    str += '</tr>';
                    $("#list_list", parent.document).append(str);
                    parent.xmselect_list_dan('zhiqianlei'+nums, parent.pub_zhiqianlei, '');
                    parent.xmselect_list_dan('incdaotype'+nums,  parent.pub_incdaotype, '');
                }

                if (typeof(window.parent.update_refresh_row_func)!="undefined"){
                    window.parent.update_refresh_row_func();
                }
            }else if(parent_page == 'qian_zhi_one'){
                $("#list_list tr", parent.document).eq(parent_domkey).find('.fuer').val(data[0].name);
                var ListZhangName = '';
                var ListZhangKai = '';
                if(data[0].list){
                    ListZhangName = data[0].list.zhangname+''+data[0].list.banknum
                    ListZhangKai = data[0].list.bankname
                }
                $("#list_list tr", parent.document).eq(parent_domkey).find('.banknum').val(ListZhangName);
                $("#list_list tr", parent.document).eq(parent_domkey).find('.bankname').val(ListZhangKai);
                $("#list_list tr", parent.document).eq(parent_domkey).find('.money').val('');
                $("#list_list tr", parent.document).eq(parent_domkey).find('.piaofee').val('');

                if (typeof(window.parent.update_refresh_row_func)!="undefined"){
                    window.parent.update_refresh_row_func();
                }
            }else if(parent_page == 'qian_piao'){
                var nums = $("#list_list tr", parent.document).length;
                for (var key in data){
                    var str = '';
                    nums++;
                    str += '<tr>';
                    str += '<td style="width: 45px">'+nums+'</td>';
                    str += '<td><input type="text" onclick="choose_dealcom_one(this)" value="'+data[key].name+'" readonly class="layui-input xiaoer disabled"></td>';
                    str += '<td><div class="qianpiaotype qianpiaotype'+nums+'" key="'+nums+'"></div></td>';
                    str += '<td><input type="text" class="layui-input nums"></td>';
                    str += '<td><input type="text" class="layui-input kaidt bdate_ymd" readonly></td>';
                    str += '<td><input type="number" class="layui-input fee"></td>';
                    str += '<td><input type="number" class="layui-input rate"></td>';
                    str += '<td><input type="number" class="layui-input ratefee"></td>';
                    str += '<td><input type="number" class="layui-input money"></td>';
                    str += '<td><input type="text" class="layui-input huidt bdate_ymd" readonly></td>';
                    str += '<td><input type="text" class="layui-input explain"></td>';
                    str += '<td><input type="text" onclick="choose_qian_zhi_guan(this)" readonly class="layui-input difee disabled"><span class="difeeobj layui-hide"></span></td>';
                    str += '</tr>';
                    $("#list_list", parent.document).append(str);
                    parent.xmselect_list_dan('qianpiaotype'+nums, parent.pub_qianpiaotype, '');
                }

                if (typeof(window.parent.update_refresh_row_func)!="undefined"){
                    window.parent.update_refresh_row_func();
                }
            }else if(parent_page == 'qian_piao_one'){
                $("#list_list tr", parent.document).eq(parent_domkey).find('.xiaoer').val(data[0].name);
                if (typeof(window.parent.update_refresh_row_func)!="undefined"){
                    window.parent.update_refresh_row_func();
                }
            }else if(parent_page == 'piao_shou'){
                var nums = $("#list_list tr", parent.document).length;
                for (var key in data){
                    var str = '';
                    nums++;
                    str += '<tr>';
                    str += '<td style="width: 45px">'+nums+'</td>';
                    str += '<td style="width: 200px;"><input type="text" onclick="choose_dealcom_one(this)" value="'+data[key].name+'" readonly class="layui-input xiaoer disabled"></td>';
                    str += '<td><input type="text" caiid="0" onclick="choose_contract_cai_one(this)" readonly value="" class="layui-input caiid disabled"></td>';
                    str += '<td><div class="qianpiaotype qianpiaotype'+nums+'" key="'+nums+'"></div></td>';
                    str += '<td style="width: 200px;"><input type="text" class="layui-input nums"></td>';
                    str += '<td><input type="text" class="layui-input kaidt bdate_ymd" readonly></td>';
                    str += '<td><input type="number" class="layui-input fee"></td>';
                    str += '<td><input type="number" class="layui-input rate"></td>';
                    str += '<td><input type="number" class="layui-input ratefee"></td>';
                    str += '<td><input type="number" class="layui-input money disabled" readonly></td>';
                    str += '<td><div class="zhikuanlei zhikuanlei'+nums+'" key="'+nums+'"></div></td>';
                    str += '<td><input type="text" class="layui-input huidt bdate_ymd" readonly></td>';
                    str += '<td><input type="text" class="layui-input explain"></td>';
                    str += '<td><input type="text" onclick="choose_piao_shou_gongzhi_guan(this)" readonly class="layui-input difee disabled"><span class="difeeobj layui-hide"></span></td>';
                    str += '</tr>';
                    $("#list_list", parent.document).append(str);
                    parent.xmselect_list_dan('qianpiaotype'+nums, parent.pub_qianpiaotype, '');
                    parent.xmselect_list_dan('zhikuanlei'+nums, parent.pub_zhikuanlei, '');
                }

                if (typeof(window.parent.update_refresh_row_func)!="undefined"){
                    window.parent.update_refresh_row_func();
                }
            }else if(parent_page == 'piao_shou_one'){
                $("#list_list tr", parent.document).eq(parent_domkey).find('.xiaoer').val(data[0].name);
                if (typeof(window.parent.update_refresh_row_func)!="undefined"){
                    window.parent.update_refresh_row_func();
                }
            }else if(parent_page == 'piao_day_one'){
                $("#list_list tr", parent.document).eq(parent_domkey).find('.xiaoer').val(data[0].name);
                if (typeof(window.parent.update_refresh_row_func)!="undefined"){
                    window.parent.update_refresh_row_func();
                }
            }else if(parent_page == 'piao_day'){
                var nums = $("#list_list tr", parent.document).length;
                for (var key in data){
                    var str = '';
                    nums++;
                    str += '<tr>';
                    str += '<td style="width: 45px">'+nums+'</td>';
                    str += '<td><input type="text"value="'+data[key].name+'" readonly class="layui-input xiaoer disabled"></td>';
                    str += '<td><div class="qianpiaotype qianpiaotype'+nums+'" key="'+nums+'"></div></td>';
                    str += '<td><input type="text" class="layui-input nums"></td>';
                    str += '<td><input type="text" class="layui-input kaidt bdate_ymd" readonly></td>';
                    str += '<td><input type="number" class="layui-input fee"></td>';
                    str += '<td><input type="number" class="layui-input rate"></td>';
                    str += '<td><input type="number" class="layui-input ratefee"></td>';
                    str += '<td><input type="number" class="layui-input money disabled" readonly></td>';
                    str += '<td><input type="text" class="layui-input huidt bdate_ymd" readonly></td>';
                    str += '<td><input type="text" class="layui-input explain"></td>';
                    str += '<td><input type="text" onclick="choose_piao_day_dayzhi_guan(this)" readonly class="layui-input difee disabled"><span class="difeeobj layui-hide"></span></td>';
                    str += '</tr>';
                    $("#list_list", parent.document).append(str);
                    parent.xmselect_list_dan('qianpiaotype'+nums, parent.pub_qianpiaotype, '');
                }

                if (typeof(window.parent.update_refresh_row_func)!="undefined"){
                    window.parent.update_refresh_row_func();
                }
            }else if(parent_page == 'piao_chu_one'){
                $("#list_list tr", parent.document).eq(parent_domkey).find('.xiaoer').val(data[0].name);
                if (typeof(window.parent.update_refresh_row_func)!="undefined"){
                    window.parent.update_refresh_row_func();
                }
            }else if(parent_page == 'tou_jiao'){
                var nums = $("#list_list tr", parent.document).length;
                for (var key in data){
                    var str = '';
                    nums++;
                    str += '<tr>';
                    str += '<td style="width: 45px">'+nums+'</td>';
                    str += '<td><input type="text" onclick="choose_dealcom_one(this)" value="'+data[key].name+'" readonly class="layui-input fuer disabled"></td>';
                    var ListZhangName = '';
                    var ListZhangKai = '';
                    if(data[key].list){
                        ListZhangName = data[key].list.zhangname+''+data[key].list.banknum
                        ListZhangKai = data[key].list.bankname
                    }
                    str += '<td><input type="text" onclick="choose_dealcom_bank(this)" value="'+ListZhangName+'" readonly class="layui-input banknum disabled"></td>';
                    str += '<td><input type="text" value="'+ListZhangKai+'" disabled class="layui-input bankname disabled"></td>';
                    str += '<td><input type="number" class="layui-input money"></td>';
                    str += '<td><div class="incdaotype incdaotype'+nums+'" key="'+nums+'"></div></td>';
                    str += '<td><input type="text" class="layui-input explain"></td>';
                    str += '</tr>';
                    $("#list_list", parent.document).append(str);
                    parent.xmselect_list_dan('incdaotype'+nums, parent.pub_incdaotype, '');
                }

                if (typeof(window.parent.update_refresh_row_func)!="undefined"){
                    window.parent.update_refresh_row_func();
                }
            }else if(parent_page == 'tou_jiao_one'){
                $("#list_list tr", parent.document).eq(parent_domkey).find('.fuer').val(data[0].name);
                var ListZhangName = '';
                var ListZhangKai = '';
                if(data[0].list){
                    ListZhangName = data[0].list.zhangname+''+data[0].list.banknum
                    ListZhangKai = data[0].list.bankname
                }
                $("#list_list tr", parent.document).eq(parent_domkey).find('.banknum').val(ListZhangName);
                $("#list_list tr", parent.document).eq(parent_domkey).find('.bankname').val(ListZhangKai);
                $("#list_list tr", parent.document).eq(parent_domkey).find('.money').val('');
                if (typeof(window.parent.update_refresh_row_func)!="undefined"){
                    window.parent.update_refresh_row_func();
                }
            }else if(parent_page == 'hou_chushui'){
                var nums = $("#list_list tr", parent.document).length;
                for (var key in data){
                    var str = '';
                    nums++;
                    str += '<tr>';
                    str += '<td style="width: 45px">'+nums+'</td>';
                    str += '<td><input type="text"  value="'+data[key].name+'" readonly class="layui-input fuer disabled"></td>';
                    str += '<td><input type="text" value="'+data[key].lei_kuan+'" class="layui-input disabled lei_kuan" disabled></td>';
                    str += '<td><input type="text" value="'+data[key].lei_piao+'" class="layui-input disabled lei_piao" disabled></td>';
                    str += '<td><input type="text" value="'+data[key].lei_shui+'" class="layui-input disabled lei_shui" disabled></td>';
                    str += '<td>';
                    str += '<select class="layui-select yiju">';
                    str += '<option value="">请选择</option>';
                    for (var mmm in parent.pub_yiju){
                        str += '<option value="'+mmm+'">'+parent.pub_yiju[mmm]+'</option>';
                    }
                    str += '</select>';
                    str += '</td>';
                    str += '<td><input type="number" class="layui-input jishuifee"></td>';
                    str += '<td><input type="number" class="layui-input yijurate"></td>';
                    str += '<td><input type="number" class="layui-input money"></td>';
                    str += '<td><div class="incdaotype incdaotype'+nums+'" key="'+nums+'"></div></td>';
                    var ListZhangName = '';
                    var ListZhangKai = '';
                    if(data[key].list){
                        ListZhangName = data[key].list.zhangname+''+data[key].list.banknum
                        ListZhangKai = data[key].list.bankname
                    }
                    str += '<td><input type="text" onclick="choose_dealcom_bank(this)" value="'+ListZhangName+'" readonly class="layui-input banknum disabled"></td>';
                    str += '<td><input type="text" value="'+ListZhangKai+'" disabled class="layui-input bankname disabled"></td>';
                    str += '<td><input type="text" class="layui-input explain"></td>';
                    str += '</tr>';
                    $("#list_list", parent.document).append(str);
                    parent.xmselect_list_dan('incdaotype'+nums, parent.pub_incdaotype, '');
                }

                if (typeof(window.parent.update_refresh_row_func)!="undefined"){
                    window.parent.update_refresh_row_func();
                }
            }else if(parent_page == 'hou_chujin'){
                var nums = $("#list_list tr", parent.document).length;
                for (var key in data){
                    var str = '';
                    nums++;
                    str += '<tr>';
                    str += '<td style="width: 45px">'+nums+'</td>';
                    str += '<td><input type="text" chuid="0" value="" class="layui-input chuid disabled" readonly></td>';
                    str += '<td><input type="text"  value="'+data[key].name+'" readonly class="layui-input fuer disabled"></td>';
                    str += '<td><input type="text" value="'+data[key].lei_kuan+'" class="layui-input disabled lei_kuan" disabled></td>';
                    str += '<td><input type="text" value="'+data[key].lei_piao+'" class="layui-input disabled lei_piao" disabled></td>';
                    str += '<td><input type="text" value="'+data[key].lei_chumoney+'" class="layui-input disabled lei_chumoney" disabled></td>';
                    str += '<td><input type="number" class="layui-input money"></td>';
                    str += '<td><div class="incdaotype incdaotype'+nums+'" key="'+nums+'"></div></td>';
                    var ListZhangName = '';
                    var ListZhangKai = '';
                    if(data[key].list){
                        ListZhangName = data[key].list.zhangname+''+data[key].list.banknum
                        ListZhangKai = data[key].list.bankname
                    }
                    str += '<td><input type="text" onclick="choose_dealcom_bank(this)" value="'+ListZhangName+'" readonly class="layui-input banknum disabled"></td>';
                    str += '<td><input type="text" value="'+ListZhangKai+'" disabled class="layui-input bankname disabled"></td>';
                    str += '<td><input type="text" class="layui-input explain"></td>';
                    str += '<td><input type="text" onclick="choose_piao_chu_guan(this)" readonly class="layui-input difee disabled"><span class="difeeobj layui-hide"></span></td>';
                    str += '</tr>';
                    $("#list_list", parent.document).append(str);
                    parent.xmselect_list_dan('incdaotype'+nums, parent.pub_incdaotype, '');
                }

                if (typeof(window.parent.update_refresh_row_func)!="undefined"){
                    window.parent.update_refresh_row_func();
                }
            }else if(parent_page == 'hou_gongshui_list'){
                var nums = $("#list_list tr", parent.document).length;
                for (var key in data){
                    var str = '';
                    nums++;
                    str += '<tr>';
                    str += '<td style="width: 45px">'+nums+'</td>';
                    str += '<td><input type="text"  value="'+data[key].name+'" readonly class="layui-input xiaoer disabled"></td>';
                    str += '<td><input type="text" value="'+data[key].gongzhifee+'" class="layui-input disabled gongzhifee" disabled></td>';
                    str += '<td><input type="text" value="'+data[key].piaoshoufee+'" class="layui-input disabled piaoshoufee" disabled></td>';
                    str += '<td><input type="text" value="'+data[key].concaimoney+'" class="layui-input disabled concaimoney" disabled></td>';
                    str += '<td><input type="text" value="'+data[key].kedifee+'" class="layui-input disabled kedifee" disabled></td>';
                    str += '<td><input type="text" value="'+data[key].yidimoney+'" class="layui-input disabled yidimoney" disabled></td>';
                    str += '<td><input type="text" value="'+data[key].yidiratefee+'" class="layui-input disabled yidiratefee" disabled></td>';
                    str += '<td><input type="text" value="'+data[key].shengdifee+'" class="layui-input disabled shengdifee" disabled></td>';
                    str += '<td><input type="text" onclick="choose_piao_shou_guan(this)" readonly class="layui-input money disabled"><span class="difeeobj layui-hide"></span></td>';
                    str += '<td><input type="text" class="layui-input disabled ratefee" disabled></td>';
                    str += '<td><input type="text" class="layui-input explain"></td>';
                    str += '</tr>';
                    $("#list_list", parent.document).append(str);
                    parent.xmselect_list_dan('incdaotype'+nums, parent.pub_incdaotype, '');
                }

                if (typeof(window.parent.update_refresh_row_func)!="undefined"){
                    window.parent.update_refresh_row_func();
                }
            }else if(parent_page == 'hou_gongzhi'){
                var nums = $("#list_list tr", parent.document).length;
                for (var key in data){
                    var str = '';
                    nums++;
                    str += '<tr>';
                    str += '<td style="width: 45px">'+nums+'</td>';
                    str += '<td><div class="zhikuanlei zhikuanlei'+nums+'" key="'+nums+'"></div></td>';
                    str += '<td><input type="text"  value="'+data[key].name+'" readonly class="layui-input fuer disabled"></td>';
                    str += '<td><input type="text" value="'+data[key].gongzhifee+'" class="layui-input disabled gongzhifee" disabled></td>';
                    str += '<td><input type="text" value="'+data[key].piaoshoufee+'" class="layui-input disabled piaoshoufee" disabled></td>';
                    str += '<td><input type="text" value="'+data[key].concaimoney+'" class="layui-input disabled concaimoney" disabled></td>';
                    str += '<td><input type="text" caiid="0" onclick="choose_contract_cai(this)" readonly placeholder="请选择" value="" class="layui-input caiid disabled"></td>';
                    str += '<td><input type="text" onclick="choose_gongzhi_qu(this)" readonly placeholder="请选择" class="layui-input money disabled"><span class="quobj layui-hide"></span></td>';
                    str += '<td><div class="incdaotype incdaotype'+nums+'" key="'+nums+'"></div></td>';
                    var ListBankzhang = '';
                    var ListBanknum = '';
                    var ListBanknname = '';
                    if(data[key].list){
                        ListBankzhang = data[key].list.zhangname
                        ListBanknum = data[key].list.banknum
                        ListBanknname = data[key].list.bankname
                    }
                    str += '<td><input type="text" onclick="choose_dealcom_bank(this)" value="'+ListBankzhang+'" readonly class="layui-input bankzhang disabled"></td>';
                    str += '<td><input type="text" value="'+ListBanknum+'" disabled class="layui-input banknum disabled"></td>';
                    str += '<td><input type="text" value="'+ListBanknname+'" disabled class="layui-input bankname disabled"></td>';
                    str += '<td><input type="text" class="layui-input explain"></td>';
                    str += '<td><input type="text" onclick="choose_piao_shou_gongzhi_guan(this)" readonly class="layui-input difee disabled"><span class="difeeobj layui-hide"></span></td>';
                    str += '</tr>';
                    $("#list_list", parent.document).append(str);
                    parent.xmselect_list_dan('incdaotype'+nums, parent.pub_incdaotype, '');
                    parent.xmselect_list_dan('zhikuanlei'+nums, parent.pub_zhikuanlei, '');
                }

                if (typeof(window.parent.update_refresh_row_func)!="undefined"){
                    window.parent.update_refresh_row_func();
                }
            }else if(parent_page == 'hou_dayzhi'){
                var nums = $("#list_list tr", parent.document).length;
                for (var key in data){
                    var str = '';
                    nums++;
                    str += '<tr>';
                    str += '<td style="width: 45px">'+nums+'</td>';
                    str += '<td><div class="zhiqilei zhiqilei'+nums+'" key="'+nums+'"></div></td>';
                    str += '<td><input type="text"  value="'+data[key].name+'" readonly class="layui-input fuer disabled"></td>';
                    var Listbankzhang = '';
                    var Listbanknum = '';
                    var Listbankname = '';
                    if(data[key].list){
                        Listbankzhang = data[key].list.zhangname
                        Listbanknum = data[key].list.banknum
                        Listbankname = data[key].list.bankname
                    }
                    str += '<td><input type="text" onclick="choose_dealcom_bank(this)" value="'+Listbankzhang+'" readonly class="layui-input bankzhang disabled"></td>';
                    str += '<td><input type="text" value="'+Listbanknum+'" disabled class="layui-input banknum disabled"></td>';
                    str += '<td><input type="text" value="'+Listbankname+'" disabled class="layui-input bankname disabled"></td>';
                    str += '<td><input type="number" class="layui-input money"></td>';
                    str += '<td><div class="incdaotype incdaotype'+nums+'" key="'+nums+'"></div></td>';
                    str += '<td><input type="text" class="layui-input explain"></td>';
                    str += '<td><input type="text" onclick="choose_piao_day_dayzhi_guan(this)" readonly class="layui-input difee disabled"><span class="difeeobj layui-hide"></span></td>';
                    str += '</tr>';
                    $("#list_list", parent.document).append(str);
                    parent.xmselect_list_dan('incdaotype'+nums, parent.pub_incdaotype, '');
                    parent.xmselect_list_dan('zhiqilei'+nums, parent.pub_zhiqilei, '');
                }

                if (typeof(window.parent.update_refresh_row_func)!="undefined"){
                    window.parent.update_refresh_row_func();
                }
            }else{
                var str = '<button type="button" class="layui-btn layui-btn-sm btn-dark" key="'+data[0].name+'"><span class="choose_content">'+data[0].name+'' +
                    '</span><span class="choose_close" onclick="choose_close(this, \''+parent_dom+'\')">×</span></button>';
                $("#"+parent_dom , parent.document).html(str);
                parent.formValid(parent_dom);

                if(parent_page == 'contract_nei'){
                    $("#dutytel" , parent.document).val(data[0].liantel);
                }

                if(parent_page == 'contract_shi'){
                    $("#fauser" , parent.document).val(data[0].lianer);
                    $("#fatel" , parent.document).val(data[0].liantel);
                }

                if(parent_page == 'piao_kai'){
                    $("#ratenum" , parent.document).val(data[0].ratenum);
                    $("#bankname" , parent.document).val(data[0].bankname);
                    $("#banknum" , parent.document).val(data[0].banknum);
                    $("#unitaddr" , parent.document).val(data[0].unitaddr);
                    $("#phone" , parent.document).val(data[0].phone);
                }

                if(parent_page == 'contract_cai'){
                    $("#gonguser" , parent.document).val(data[0].lianer);
                    $("#gongtel" , parent.document).val(data[0].liantel);
                }

                if(parent_page == 'contract_chu'){
                    $("#gongtel" , parent.document).val(data[0].liantel);
                }

                if(parent_page == 'contract_ling'){
                    $("#gongtel" , parent.document).val(data[0].liantel);
                }


                if(parent_page == 'payment_day'){
                    $("#bankname" , parent.document).val(data[0].bankname);
                    $("#banknum" , parent.document).val(data[0].banknum);
                }
                if(parent_page == 'payment_neifu'){
                    $("#bankname" , parent.document).val(data[0].bankname);
                    $("#banknum" , parent.document).val(data[0].banknum);
                }

                if(parent_page == 'engin_bond_jiao'){
                    $("#bankname" , parent.document).val(data[0].bankname);
                    $("#banknum" , parent.document).val(data[0].banknum);
                }
                if(parent_page == 'engin_bond_fan'){
                    $("#bankname" , parent.document).val(data[0].bankname);
                    $("#banknum" , parent.document).val(data[0].banknum);
                }
                if(parent_page == 'stuff_jie'){
                    $("#caiid", parent.document).html('');
                    $("#jie_list", parent.document).html('');
                }
                if(parent_page == 'piao_chu'){
                    $("#gongertel" , parent.document).val(data[0].liantel);
                    $("#conchufee" , parent.document).val(data[0].conchufee);
                    $("#piaochufee" , parent.document).val(data[0].piaochufee);
                }
                if(parent_page == 'payment_chu'){
                    $("#lian_unit_tel" , parent.document).val(data[0].liantel);
                    $("#conchufee" , parent.document).val(data[0].conchufee);
                    $("#piaochufee" , parent.document).val(data[0].piaochufee);
                    $("#paychufee" , parent.document).val(data[0].paychufee);

                    if (typeof(window.parent.get_all_paychufee)!="undefined"){
                        window.parent.get_all_paychufee();
                    }
                }


                if(parent_page == 'hou_gongshui'){
                    var ListZhangName = '';
                    var ListZhangKai = '';
                    if(data[0].list){
                        ListZhangName = data[0].list.zhangname+''+data[0].list.banknum
                        ListZhangKai = data[0].list.bankname
                    }

                    if(ListZhangName){
                        var bankstr = '<button type="button" class="layui-btn layui-btn-sm btn-dark" key="'+ListZhangName+'"><span class="choose_content">'+ListZhangName+'' +
                            '</span><span class="choose_close" onclick="choose_close(this, \'banknum\')">×</span></button>';
                        $("#banknum" , parent.document).html(bankstr);
                        parent.formValid('banknum');
                    }
                    if(ListZhangName){
                        $("#bankname" , parent.document).val(ListZhangKai);
                    }
                }

                if(parent_page == 'hou_bao'){
                    var Listbankzhang = '';
                    var Listbanknum = '';
                    var Listbankname = '';
                    if(data[0].list){
                        Listbankzhang = data[0].list.zhangname
                        Listbanknum = data[0].list.banknum
                        Listbankname = data[0].list.bankname
                    }

                    if(ListZhangName){
                        var bankstr = '<button type="button" class="layui-btn layui-btn-sm btn-dark" key="'+Listbankzhang+'"><span class="choose_content">'+Listbankzhang+'' +
                            '</span><span class="choose_close" onclick="choose_close(this, \'bankzhang\')">×</span></button>';
                        $("#bankzhang" , parent.document).html(bankstr);
                        parent.formValid('bankzhang');
                    }
                    if(ListZhangName){
                        $("#banknum" , parent.document).val(Listbanknum);
                        $("#bankname" , parent.document).val(Listbankname);
                    }
                }

                if(parent_page == 'hou_jie_jieer'){
                    if(data[0].zheng){
                        if(data[0].zheng.name){
                            var zhengstr = '<button type="button" class="layui-btn layui-btn-sm btn-dark" key="'+data[0].zheng.name+'"><span class="choose_content">'+data[0].zheng.name+'' +
                                '</span><span class="choose_close" onclick="choose_close(this, \'jie_ming\')">×</span></button>';
                            $("#jie_ming" , parent.document).html(zhengstr);
                            parent.formValid('jie_ming');
                            $("#jie_bian" , parent.document).val(data[0].zheng.number);
                        }
                    }

                    $("#jie_tel" , parent.document).val(data[0].liantel);
                    $("#jie_addr" , parent.document).val(data[0].lianaddr);

                    if(data[0].list){
                        var ListZhangName = data[0].list.zhangname+''+data[0].list.banknum
                        var ListZhangKai = data[0].list.bankname
                        if(ListZhangName){
                            var bankstr = '<button type="button" class="layui-btn layui-btn-sm btn-dark" key="'+ListZhangName+'"><span class="choose_content">'+ListZhangName+'' +
                                '</span><span class="choose_close" onclick="choose_close(this, \'banknum\')">×</span></button>';
                            $("#banknum" , parent.document).html(bankstr);
                            parent.formValid('banknum');
                            $("#bankname" , parent.document).val(ListZhangKai);
                        }
                    }
                }
                if(parent_page == 'hou_jie_chuer'){
                    if(data[0].zheng){
                        if(data[0].zheng.name){
                            var zhengstr = '<button type="button" class="layui-btn layui-btn-sm btn-dark" key="'+data[0].zheng.name+'"><span class="choose_content">'+data[0].zheng.name+'' +
                                '</span><span class="choose_close" onclick="choose_close(this, \'chu_ming\')">×</span></button>';
                            $("#chu_ming" , parent.document).html(zhengstr);
                            parent.formValid('chu_ming');
                            $("#chu_bian" , parent.document).val(data[0].zheng.number);
                        }
                    }
                    $("#chu_tel" , parent.document).val(data[0].liantel);
                    $("#chu_addr" , parent.document).val(data[0].lianaddr);
                }
                if(parent_page == 'hou_jie_daner'){
                    if(data[0].zheng){
                        if(data[0].zheng.name){
                            var zhengstr = '<button type="button" class="layui-btn layui-btn-sm btn-dark" key="'+data[0].zheng.name+'"><span class="choose_content">'+data[0].zheng.name+'' +
                                '</span><span class="choose_close" onclick="choose_close(this, \'dan_ming\')">×</span></button>';
                            $("#dan_ming" , parent.document).html(zhengstr);
                            parent.formValid('dan_ming');
                            $("#dan_bian" , parent.document).val(data[0].zheng.number);
                        }
                    }
                    $("#dan_tel" , parent.document).val(data[0].liantel);
                    $("#dan_addr" , parent.document).val(data[0].lianaddr);
                }


                if(parent_page == 'hou_gongyu'){
                    $("#gofutel" , parent.document).val(data[0].liantel);
                    $('#hougongyumoney', parent.document).text(data[0].hougongyumoney);
                    $('#hougongzhimoneyqugoer', parent.document).text(data[0].hougongzhimoneyqugoer);
                    $('#hougongyukoufee', parent.document).text(data[0].hougongyukoufee);
                    $('#qizankoufee', parent.document).text(data[0].qizankoufee);
                    $('#jiedongkoufee', parent.document).text(data[0].jiedongkoufee);
                    $('#yuliufee', parent.document).text(data[0].yuliufee);
                    $('#hougongshuimoneygoquan', parent.document).text(data[0].hougongshuimoneygoquan);
                    $('#hougongyukeyong', parent.document).text(data[0].hougongyukeyong);
                }


                if(parent_page == 'engin_shui'){
                    $("#chentel" , parent.document).val(data[0].liantel);
                }

            }

            layer_close();
        });




    });



    function auth_but_func_add_flow(){
        openPageEdit('../dealcom/flow_add.php?close=1');
    }
    function auth_but_func_show(id){
        openPage('../dealcom/show.php?id='+id);
    }
    function auth_but_func_edit(id){
        openPageEdit('../dealcom/edit.php?close=1&id='+id);
    }
</script>
</body>
</html>
